<?php
interface MyIterator{
    public function first();
    public function next();
    public function isDone();
    public function currentItem();
}

//abstract class Aggregate{
//    public abstract function createIterator();
//}

class ConcreteIterator implements MyIterator{
    private $aggregate;
    private $current = 0;

    public function __construct($aggregate)
    {
        $this->aggregate = $aggregate;
    }

    public function first(){
        return $this->aggregate[0];
    }
    public function next(){
        $this->current++;
        if($this->current<count($this->aggregate)){
            return $this->aggregate[$this->current];
        }else{
            return null;
        }

    }
    public function isDone(){
        return ($this->current>=count($this->aggregate))?ture:fals;
    }
    public function currentItem(){
        return $this->aggregate[$this->current];
    }
}
